package chain_of_responsibility

import "fmt"

type Medical struct {
	next department
}

func (m *Medical) Execute(p *Patient) {
	if p.medicineDone {
		fmt.Println("Medicine already given to Patient")
		m.next.Execute(p)
		return
	}
	fmt.Println("Medical giving medicine to Patient")
	p.medicineDone = true
	m.next.Execute(p)
}

func (m *Medical) SetNext(d department) {
	m.next = d
}

